<?php

namespace app\modules\admin\models;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ViewError
 *
 * @author shuai
 */
class ViewError extends \app\components\BaseViewList
{
    public function get_model()
    {
        /// \app\models\Bizhi::className()
        return new  \app\models\Error;
    }

    public $show_add = false;///显示添加按钮


    /**
     * 获取表格的唯一名字
     */
    public function getName()
    {
        return 'error';
    }
    /**
     * 是否显示删除按钮
     */
    //  public $show_delete=false;

    /**
     * 是否显示复选框
     */
    // public $show_select_box=false;


    public $auto_detection = 5;

    /**
     * 需要继承,然后定义每行需要显示的数据格式
     */
    public function Labels()
    {
        return array(
            'id' => array('style' => 'width:50px'),
            'msg' => '',
            'time' => '',
            'type' => '',
            'control' => [
                'edit',
                'delete'
            ]
        );

    }

    /**
     * 方便继承,多一层过滤
     * 这里过滤一下时间
     */
    public function ModelTohtml($key, $model)
    {

        if ($key === 'time') {
            return $this->toTime($model->$key);
        }
        if ($key === 'type') {
            return $this->toType([
                \app\models\Error::Err_putong => '普通',
                \app\models\Error::Err_yanzhong => '严重',
                \app\models\Error::Err_zhongji => '中级'

            ], $model->$key);
        }

        return $model->$key;
    }

    /*
    public function Label_id(){
        return 'ID编码';
    }
    */
    /**
     * 对话框中的各个字段
     */
    public function dialog()
    {

        return array(
            array(
                'title' => '内容',
                'zd' => 'msg',
                ///'type'=>'img'
            ),
            array(
                'title' => 'time',
                'zd' => 'time'
            ),
        );
    }

}
